package com.njtoyo.taxi.admin.mapper.master.fields.operation_rule;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;

@Data
@ApiModel(value = "司机手续费")
public class DriverFeeRate {
    @NotNull(message = "通用配置不能为空")
    @Valid
    private General general;
    @Valid
    private List<Special> special;
    
    @Data
    @Valid
    public static class General {
        @ApiModelProperty(value = "司机分成比")
        @NotNull(message = "司机分成比不能为空")
        @Range(min = 0, max = 1, message = "司机分成比只能在0-1之间")
        private BigDecimal driverEarningRatio;
        
        @ApiModelProperty(value = "公司分成比")
        @NotNull(message = "公司分成比不能为空")
        @Range(min = 0, max = 1, message = "公司分成比只能在0-1之间")
        private BigDecimal companyEarningRatio;
        
        @ApiModelProperty(value = "最高金额")
        @NotNull(message = "最高金额不能为空")
        private BigDecimal maxFee;
    }

    @Data
    @Valid
    public static class Special {
        @ApiModelProperty(value = "公司ID")
        @NotNull(message = "公司ID不能为空")
        private Long companyId;

        @ApiModelProperty(value = "司机分成比")
        @NotNull(message = "司机分成比不能为空")
        @Range(min = 0, max = 1, message = "司机分成比只能在0-1之间")
        private BigDecimal driverEarningRatio;

        @ApiModelProperty(value = "公司分成比")
        @NotNull(message = "公司分成比不能为空")
        @Range(min = 0, max = 1, message = "公司分成比只能在0-1之间")
        private BigDecimal companyEarningRatio;

        @ApiModelProperty(value = "最高金额")
        @NotNull(message = "最高金额不能为空")
        private BigDecimal maxFee;
    }
}
